package com.valenx.distributedmulticamerasystem.camera.constant;

import java.lang.invoke.MethodHandles;

//相机模式
public enum RemoteCommand {
    REMOTE_ACTION(1,"REMOTE_ACTION"),//远程拍摄
    CHANGE_CAMERA_MODE(2,"CHANGE_CAMERA_MODE"),//改变远程相机模式
    CHANGE_CAMERA_TYPE(3,"CHANGE_CAMERA_TYPE"),//改变远程相机朝向
    START_PUSHFLOW(4,"START_PUSHFLOW"),//从机开始推流
    STOP_PUSHFLOW(5,"STOP_PUSHFLOW"),//从机停止推流
    SEND_ENCODED_DATA(6,"SEND_ENCODED_DATA");//从机发送已编码数据给主机

    private final int requestCode;//相机模式ID
    private final String action;

    RemoteCommand(int requestCode,String action) {
        this.requestCode = requestCode;
        this.action = action;
    }

    public static RemoteCommand getByCode(int code) {
        for (RemoteCommand x : values()) {
            if (x.requestCode == code) {
                return x;
            }
        }
        return null;
    }

    public static RemoteCommand getByAction(String action) {
        for (RemoteCommand x : values()) {
            if (x.action == action) {
                return x;
            }
        }
        return null;
    }

    public int requestCode() {
        return requestCode;
    }
    public String action() {
        return action;
    }
}
